home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 7959 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1005 b   |  33 lines

  1. Path: news.informatik.uni-muenchen.de!usenet
  2. From: Kurt Watzka <watzka@stat.uni-muenchen.de>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: New (but motivated) C user looking for help . . .
  5. Date: Wed, 28 Feb 1996 15:53:29 +0100
  6. Organization: Institut fⁿr Statistik
  7. Message-ID: <31346C69.2BB2@stat.uni-muenchen.de>
  8. NNTP-Posting-Host: pc7.stat.uni-muenchen.de
  9. Mime-Version: 1.0
  10. Content-Type: text/plain; charset=us-ascii
  11. Content-Transfer-Encoding: 7bit
  12. X-Mailer: Mozilla 2.0 (WinNT; I)
  13. CC: sconnors@teleport.com
  14.  
  15. Steve wrote:
  16. > Hello,
  17. > I'm trying to write a program that will gather an
  18. > ip address, and a subnet mask typed in at the
  19. > keyboard, and do a bitwise AND to view the result.
  20. > First I thought I could bring the dotted octet in
  21. > as an integer, but quickly found that I could not.
  22. >
  23.  
  24. Try reading _four_ unsigned integers and combining them
  25. with bitwise shifts. As in most cases, sscanf() will be
  26. your friend. "%u.%u.%u.%u" is probably not the worst
  27. possible format string for your problem.
  28.  
  29. Kurt
  30.